<?php
$TaskName=$_POST['Task_Name'] ?? '';
//$TaskContent=$_POST['Task_Content'] ?? '';
$dsn= "sqlsrv:Server=localhost;Database=Task";
$db= new PDO($dsn, "sa", "123456");
$sql= "insert into Task (TaskName) values('{$TaskName}') ";
$result= $db->exec($sql);
if ($result) {
    echo '增加任务成功，前往<a href="list.php">列表页</a>';
} else {
    echo '添加失败';
}